-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix mode switch icon sizing issue #8316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Changed PocketKnife icon from className="w-4" to className="size-4" - This ensures both width and height are set to prevent icon shrinking - Aligns with TerminalSquare icon implementation for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review engaged: evaluating my own icon-size fix with impeccably unbiased, machine-grade bias.
| <> | ||
| <div style={headerStyle}> | ||
| <PocketKnife className="w-4" aria-label="Switch mode icon" /> | ||
| <PocketKnife className="size-4" aria-label="Switch mode icon" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: To fully prevent flex layouts from shrinking the icon, consider adding Tailwind shrink-0 alongside size-4. This keeps the icon at 16px even under flexbox pressure.
| <> | ||
| <div style={headerStyle}> | ||
| <PocketKnife className="w-4" aria-label="Switch mode icon" /> | ||
| <PocketKnife className="size-4" aria-label="Switch mode icon" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3 (a11y): If the icon is decorative (adjacent text conveys the meaning), prefer aria-hidden="true" without an aria-label. If it is meaningful on its own, ensure the label is specific and not redundant.
|
Closing in favor of #8343 |
Summary
Fixes the issue where the mode switch icon (PocketKnife) sometimes appears tiny or shrinks down.
Problem
The PocketKnife icon for mode switches was using
className="w-4"which only sets the width. When the icon's container used flex layouts or didn't preserve aspect ratio, the icon would shrink vertically, appearing tiny.Solution
Changed from
className="w-4"toclassName="size-4"to explicitly set both width and height to 1rem (16px), preventing the icon from shrinking.Changes
w-4tosize-4size-4Testing
Context
This fix was requested via Slack: "Why is the icon sometimes tiny for mode switches? Can you fix it so it doesn't shrink down?"
The
size-4utility in Tailwind CSS sets both width and height, ensuring the icon maintains its proper dimensions regardless of container layout.Important
Fixes mode switch icon sizing issue in
ChatRow.tsxby changingclassNamefromw-4tosize-4.ChatRow.tsxby changingclassNamefromw-4tosize-4.This description was created by
for 46dd63b. You can customize this summary. It will automatically update as commits are pushed.